package com.challenge.sewercoverbackend.domian;

import com.challenge.sewercoverbackend.mapper.CoverMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author 24270
 * @author 25835
 */
@Service
public class CoverService {
    @Autowired
    private CoverMapper mapper;

    // TODO 没写完
    public List<Cover> getAll() {
        return mapper.selectList(null);
    }

    public int getCount(String tablename) {
        return mapper.getCount(tablename);
    }

    public Cover getLatestOne(String tablename) {
        return mapper.getLatestOne(tablename);
    }

    public List<Cover> getByCH4(int t) {
        return mapper.getByCH4(t);
    }

    public double getAvgCH4(String tablename) {
        return mapper.getAvgCH4(tablename);
    }

    public double getAvgCO(String tablename) {
        return mapper.gerAvgCO(tablename);
    }

    public List<Cover> getCoverByTime(String timeSelect) {
        return mapper.getCoverByTime(timeSelect);
    }

    public List<Cover> getCoverByTwoTime(String tablename, String begintime, String endtime) {
        return mapper.getCoverByTwoTime(tablename, begintime, endtime);
    }

    public List<Cover> getLatestTwenty() {
        return mapper.getLatestTwenty();
    }

    public List<Cover> getLatestByNum(String tablename, int number) {
        return mapper.getLatestByNum(tablename, number);
    }

    public List<Integer> getCOByNum(String tablename, int number) {
        return mapper.getCOByNum(tablename, number);
    }

    public List<Integer> getCH4ByNum(String tablename, int number) {
        return mapper.getCH4ByNum(tablename, number);
    }

    public int getElectricity(String tablename) {
        return mapper.getElectricity(tablename);
    }

    public int getTestDouble(String tablename,int number){
        return mapper.getTestDouble(tablename, number);
    }

}
